package com.anche.cywebnew.Utils.query;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;


public class GetRecv
{
	private static String URL = "http://56.32.4.182:8021/sms-boot/sms/send/getRecvSms";
	
	public static void main(String[] args)
	{
		String userName = "用户名";
		String password = "密码";
		String recvTime = "2023-09-01 10:00:00";
		String longid = "分配特服号码（原来有的不变）";
		
		getRecv(userName, password, recvTime, longid);
	}
	
	public static void getRecv(String userName, String passWord, String recvTime, String longid)
	{
		String token = MakeToken.getToken(userName, passWord);
		if (token.length() > 1)
		{
			JSONObject param = new JSONObject();
			param.put("recvTime", recvTime);
			param.put("longId", longid);
			
			String response = HttpUtil.post(URL, token, param.toString());
			JSONObject obj = JSONObject.parseObject(response);
			/*
			 * {"success":true,"message":"","code":0,"result":[{"id":"20230908090407265947","sendId":"0","srcmobile":"13000000000","msgContent":"1","longId":"特服号","recvTime":"2023-09-08 09:03:09","createTime":"2023-09-08 09:04:07","updateTime":null}],"timestamp":1697168647570}
			 */
			if (0 == obj.getIntValue("code"))
			{
				JSONArray result = obj.getJSONArray("result");
				// [{"id":"20230908090407265947","sendId":"0","srcmobile":"13000000000","msgContent":"1","longId":"特服号","recvTime":"2023-09-08 09:03:09","createTime":"2023-09-08 09:04:07","updateTime":null}]
				System.out.println(result);
			}
		}
	}
}